home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HTAAProt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  7.5 KB  |  232 lines

  1. /*                                   PROTECTION SETUP FILE
  2.                                              
  3.  */
  4.  
  5. #ifndef HTAAPROT_H
  6. #define HTAAPROT_H
  7.  
  8. #ifndef HTUTILS_H
  9. #include "HTUtils.h"
  10. #endif /* HTUTILS_H */
  11. #include "HTGroup.h"
  12. #include "HTAssoc.h"
  13.  
  14. #ifdef SHORT_NAMES
  15. #define HTAAgUid        HTAA_getUid
  16. #define HTAAgGid        HTAA_getGid
  17. #define HTAAgDPr        HTAA_setDefaultProtection
  18. #define HTAAsCPr        HTAA_setCurrentProtection
  19. #define HTAAgCPr        HTAA_getCurrentProtection
  20. #define HTAAgDPr        HTAA_getDefaultProtection
  21. #define HTAAclPr        HTAA_clearProtections
  22. #endif /*SHORT_NAMES*/
  23. /*
  24.  
  25. Server's Representation of Document (Tree) Protections
  26.  
  27.  */
  28.  
  29. typedef struct {
  30.     char *        template;     /* Template for this protection         */
  31.     char *        filename;     /* Current document file                */
  32.     char *        uid_name;     /* Effective uid (name of it)           */
  33.     char *        gid_name;     /* Effective gid (name of it)           */
  34.     GroupDef *    mask_group;   /* Allowed users and IP addresses       */
  35.     HTList *      valid_schemes;/* Valid authentication schemes         */
  36.     HTAssocList * values;       /* Association list for scheme specific */
  37.                                 /* parameters.                          */
  38. } HTAAProt;
  39. /*
  40.  
  41. Callbacks for rule system
  42.  
  43.    The following three functioncs are called by the rule system:
  44.    
  45.       HTAA_clearProtections() when starting to translate a filename
  46.       
  47.       HTAA_setDefaultProtection() when "defprot" rule is matched
  48.       
  49.       HTAA_setCurrentProtection() when "protect" rule is matched
  50.       
  51.    Protection setup files are cached by these functions.
  52.    
  53.  */
  54.  
  55. /* PUBLIC                                       HTAA_setDefaultProtection()
  56. **              SET THE DEFAULT PROTECTION MODE
  57. **              (called by rule system when a
  58. **              "defprot" rule is matched)
  59. ** ON ENTRY:
  60. **      cur_docname     is the current result of rule translations.
  61. **      prot_filename   is the protection setup file (second argument
  62. **                      for "defprot" rule, optional)
  63. **      eff_ids         contains user and group names separated by
  64. **                      a dot, corresponding to the effective uid
  65. **                      gid under which the server should run,
  66. **                      default is "nobody.nogroup" (third argument
  67. **                      for "defprot" rule, optional; can be given
  68. **                      only if protection setup file is also given).
  69. **
  70. ** ON EXIT:
  71. **      returns         nothing.
  72. **                      Sets the module-wide variable default_prot.
  73. */
  74. PUBLIC void HTAA_setDefaultProtection PARAMS((CONST char *      cur_docname,
  75.                                               CONST char *      prot_filename,
  76.                                               CONST char *      eff_ids));
  77.  
  78.  
  79.  
  80. /* PUBLIC                                       HTAA_setCurrentProtection()
  81. **              SET THE CURRENT PROTECTION MODE
  82. **              (called by rule system when a
  83. **              "protect" rule is matched)
  84. ** ON ENTRY:
  85. **      cur_docname     is the current result of rule translations.
  86. **      prot_filename   is the protection setup file (second argument
  87. **                      for "protect" rule, optional)
  88. **      eff_ids         contains user and group names separated by
  89. **                      a dot, corresponding to the effective uid
  90. **                      gid under which the server should run,
  91. **                      default is "nobody.nogroup" (third argument
  92. **                      for "protect" rule, optional; can be given
  93. **                      only if protection setup file is also given).
  94. **
  95. ** ON EXIT:
  96. **      returns         nothing.
  97. **                      Sets the module-wide variable current_prot.
  98. */
  99. PUBLIC void HTAA_setCurrentProtection PARAMS((CONST char *      cur_docname,
  100.                                               CONST char *      prot_filename,
  101.                                               CONST char *      eff_ids));
  102.  
  103.  
  104. /* SERVER INTERNAL                                      HTAA_clearProtections()
  105. **              CLEAR DOCUMENT PROTECTION MODE
  106. **              (ALSO DEFAULT PROTECTION)
  107. **              (called by the rule system)
  108. ** ON ENTRY:
  109. **      No arguments.
  110. **
  111. ** ON EXIT:
  112. **      returns nothing.
  113. **              Frees the memory used by protection information.
  114. */
  115. PUBLIC void HTAA_clearProtections NOPARAMS;
  116. /*
  117.  
  118. Getting Protection Settings
  119.  
  120.       HTAA_getCurrentProtection() returns the current protection mode (if there was a
  121.       "protect" rule). NULL, if no "protect" rule has been matched.
  122.       
  123.       HTAA_getDefaultProtection() sets the current protection mode to what it was set to
  124.       by "defprot" rule and also returns it (therefore after this call also
  125.       HTAA_getCurrentProtection() returns the same structure.
  126.       
  127.  */
  128.  
  129. /* PUBLIC                                       HTAA_getCurrentProtection()
  130. **              GET CURRENT PROTECTION SETUP STRUCTURE
  131. **              (this is set up by callbacks made from
  132. **               the rule system when matching "protect"
  133. **               (and "defprot") rules)
  134. ** ON ENTRY:
  135. **      HTTranslate() must have been called before calling
  136. **      this function.
  137. **
  138. ** ON EXIT:
  139. **      returns a HTAAProt structure representing the
  140. **              protection setup of the HTTranslate()'d file.
  141. **              This must not be free()'d.
  142. */
  143. PUBLIC HTAAProt *HTAA_getCurrentProtection NOPARAMS;
  144.  
  145.  
  146.  
  147. /* PUBLIC                                       HTAA_getDefaultProtection()
  148. **              GET DEFAULT PROTECTION SETUP STRUCTURE
  149. **              (this is set up by callbacks made from
  150. **               the rule system when matching "defprot"
  151. **               rules)
  152. ** ON ENTRY:
  153. **      HTTranslate() must have been called before calling
  154. **      this function.
  155. **
  156. ** ON EXIT:
  157. **      returns a HTAAProt structure representing the
  158. **              default protection setup of the HTTranslate()'d
  159. **              file (if HTAA_getCurrentProtection() returned
  160. **              NULL, i.e. if there is no "protect" rule
  161. **              but ACL exists, and we need to know default
  162. **              protection settings).
  163. **              This must not be free()'d.
  164. */
  165. PUBLIC HTAAProt *HTAA_getDefaultProtection NOPARAMS;
  166. /*
  167.  
  168. Get User and Group IDs to Which Set to
  169.  
  170.  */
  171.  
  172. #ifndef VMS
  173. /* PUBLIC                                                       HTAA_getUid()
  174. **              GET THE USER ID TO CHANGE THE PROCESS UID TO
  175. ** ON ENTRY:
  176. **      No arguments.
  177. **
  178. ** ON EXIT:
  179. **      returns the uid number to give to setuid() system call.
  180. **              Default is 65534 (nobody).
  181. */
  182. PUBLIC int HTAA_getUid NOPARAMS;
  183.  
  184.  
  185. /* PUBLIC                                                       HTAA_getGid()
  186. **              GET THE GROUP ID TO CHANGE THE PROCESS GID TO
  187. ** ON ENTRY:
  188. **      No arguments.
  189. **
  190. ** ON EXIT:
  191. **      returns the uid number to give to setgid() system call.
  192. **              Default is 65534 (nogroup).
  193. */
  194. PUBLIC int HTAA_getGid NOPARAMS;
  195. #endif /* not VMS */
  196. /*
  197.  
  198.    For VMS:
  199.    
  200.  */
  201.  
  202. #ifdef VMS
  203. /* PUBLIC                                                       HTAA_getUidName()
  204. **              GET THE USER ID NAME (VMS ONLY)
  205. ** ON ENTRY:
  206. **      No arguments.
  207. **
  208. ** ON EXIT:
  209. **      returns the user name
  210. **              Default is "" (nobody).
  211. */
  212. PUBLIC char * HTAA_getUidName NOPARAMS;
  213.  
  214. /* PUBLIC                                                       HTAA_getFileName
  215. **              GET THE FILENAME (VMS ONLY)
  216. ** ON ENTRY:
  217. **      No arguments.
  218. **
  219. ** ON EXIT:
  220. **      returns the filename
  221. */
  222. PUBLIC char * HTAA_getFileName NOPARAMS;
  223. #endif /* VMS */
  224. /*
  225.  
  226.  */
  227.  
  228. #endif /* not HTAAPROT_H */
  229. /*
  230.  
  231.    End of file HTAAProt.h.  */
  232.